package com.example.Lezedata.ui.annPage;

import android.content.Context;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.Lezedata.R;
import com.example.Lezedata.util.GBTimeManager;
import com.example.Lezedata.util.GBUtil;

import bid.SystemAnnouncement;


public class AnnListCell extends LinearLayout {

    public SystemAnnouncement.TBAnnouncement pool;
    private ImageView imageViewIcon;
    private TextView textViewTitle,textViewTime;

    public static com.example.Lezedata.ui.annPage.AnnListCell newInstance(Context context , ViewGroup viewGroup) {
        com.example.Lezedata.ui.annPage.AnnListCell cell = (com.example.Lezedata.ui.annPage.AnnListCell)LayoutInflater.from(context).inflate(R.layout.ann_list_cell,viewGroup,false);

        return cell;
    }

    public AnnListCell(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        imageViewIcon = findViewById(R.id.imageView_icon );
        textViewTitle = findViewById(R.id.textView_title );
        textViewTime= findViewById(R.id.textView_time);

    }

    public void setPool(SystemAnnouncement.TBAnnouncement pool) {
        this.pool = pool;
        textViewTitle.setText(String.valueOf(pool.getTitle()));
        textViewTime.setText(GBUtil.formatDateTime(pool.getCreatTime()));
        GBUtil.setGoodsImage(imageViewIcon,pool.getIconUrl());
    }
}
